import axios from "@/utils/http";

//数据
const state = {
  //总数据
  tableData: [],
  //分页数据
  tableTotal: 1,
  //获取所有数据
  allData:[],

};

const getters = {


};

const actions = {};

const mutations = {
  /* setDepartmentData */
  /* ———————————————————————————— 获取所有的数据 ———————————————————————————— */
  setData(state: any, page: any) {
    console.log("page", page);

    axios({
      url:"/seeDoctor/bank/lookBank",
      method: "get",
      params: {
        CurrentPage: page.currentPage,
        // PageSize: page.pageSize,
        PageSize:10,
      },
    })
      .then((res: any) => {
        console.log("字典数据", res.data);
        state.tableData = res.data.data;
        state.tableTotal = res.data.count;
      })
      .catch((err) => {
        console.log(err);
      });
  },

  departmentFilterData(state: any, search: any) {
    let filterData:any=[];
    console.log(search,filterData);
    console.log(state.tableData);
    state.tableData.forEach((item:any) => {
          if(item.officeName==search||!search||!item.officeName.indexOf(search)){
            filterData.push(item)
          }
      });
      console.log(filterData);
      state.tableData=filterData
  },

   


 
  }

export default {
  state,
  mutations,
  actions,
  getters,
};
